package QL;

import java.util.List;
import java.util.ArrayList;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class ButlerBroadcastMessageGetListResponse extends BaseQLResponse
{
    /// <summary>
    /// 跑马灯消息列表
    /// </summary>
    public List<ButlerBroadcastMessageInfo> ResultList;

    /// <summary>
    /// 总数量
    /// </summary>
    public long TotalCount;

    @Override
    public void DeserializeFromJson(JSONObject jsonObj)
    {
        JSONObject t = jsonObj.getJSONObject("error_response");
        if (t != null && !t.isNullObject())
        {
            ErrCode = t.getString("code");
            ErrMsg = t.getString("msg");
        }
        else
        {
            t = jsonObj.getJSONObject("butler_broadcast_message_get_list_response");
            ResultList = new ArrayList<ButlerBroadcastMessageInfo>();
            JSONArray arrResultList = t.getJSONObject("result_list").getJSONArray("butler_broadcast_message_info");
            for (int i = 0; i < arrResultList.size(); ++i)
            {
                ButlerBroadcastMessageInfo o = new ButlerBroadcastMessageInfo();
                o.DeserializeFromJson(arrResultList.getJSONObject(i));
                ResultList.add(o);
            }
            if (t.has("total_count"))
                TotalCount = t.getLong("total_count");
        }
    }
}
